{% import "form_helpers.html" as form_helpers %}
{% extends "base.html" %}
{% block content %}
    <heading>
        <h1>Partners</h1>
    </heading>
    <table class="table table-hover">
        <thead>
            <tr>
                <td>Name</td>
                <td>Base URL</td>
                <td>Auth Token</td>
                <td>Actions</td>
            </tr>
        </thead>
        {% for partner in partners %}
            <tr>
                <td>{{ partner.name }}</td>
                <td>{{ partner.baseurl }}</td>
                <td>{{ partner.auth_token }}</td>
                <td>
                    <form method="POST" action="{{ url_for('partner_delete', id=partner.key.id()) }}"
                          style="display: inline">
                        {{ partner_delete_form.csrf_token }}
                        <input type="submit" class="btn btn-danger" value="{{ _('Delete') }}">
                    </form>
                </td>
            </tr>
        {% endfor %}
    </table>
    {% call form_helpers.render_form(partner_add_form, url_for('partners')) %}
        <input type="submit" class="btn btn-primary" value="{{ _('Add') }}">
        <a class="btn" href="javascript:history.back()">{{ _('Cancel') }}</a>
    {% endcall %}
{% endblock %}
